package com.huawei.hms.support.api.pay.json;

import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.internal.ResponseErrorCode;
import com.huawei.hms.common.internal.TaskApiCall;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.pay.ProductDetailResp;
import com.huawei.hms.support.api.pay.ProductDetailResult;
import com.huawei.hms.support.log.HMSLog;
import com.huawei.hms.utils.JsonUtil;
import o.fjx;

public class ProductDetailTaskApiCall extends TaskApiCall<PayHmsClient, ProductDetailResult> {
    public ProductDetailTaskApiCall(String str, String str2) {
        super(str, str2);
    }

    protected void doExecute(PayHmsClient payHmsClient, ResponseErrorCode responseErrorCode, String str, fjx<ProductDetailResult> o_fjx_com_huawei_hms_support_api_pay_ProductDetailResult) {
        if (responseErrorCode == null) {
            o_fjx_com_huawei_hms_support_api_pay_ProductDetailResult.ॱ(new ApiException(new Status(1)));
        } else if (responseErrorCode.getErrorCode() == 0) {
            HMSLog.i("ProductDetailTaskApiCall", "onResult, success");
            ProductDetailResp productDetailResp = new ProductDetailResp();
            JsonUtil.jsonToEntity(str, productDetailResp);
            ProductDetailResult productDetailResult = new ProductDetailResult();
            productDetailResult.setProductList(productDetailResp.productList);
            productDetailResult.setStatus(new Status(productDetailResp.returnCode, productDetailResp.errMsg));
            productDetailResult.setFailList(productDetailResp.getFailList());
            productDetailResult.setProductList(productDetailResp.getProductList());
            productDetailResult.setRequestId(productDetailResp.getRequestId());
            o_fjx_com_huawei_hms_support_api_pay_ProductDetailResult.ॱ(productDetailResult);
        } else {
            HMSLog.i("ProductDetailTaskApiCall", "onResult, returnCode: " + responseErrorCode.getErrorCode());
            o_fjx_com_huawei_hms_support_api_pay_ProductDetailResult.ॱ(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason())));
        }
    }
}
